<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="renderer" content="webkit">
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <title>go8商城</title>
    <link rel="stylesheet" href="/style/style.css">
	
</head>

<body>
    <!-- 顶部栏目 -->
	<div id="header" th:insert="header :: header"></div>
    <div class="wrap">
		<div id="pay" style="margin: 10px">
			<Alert>扫码支付<template slot="desc">请扫描右边二维码进行支付</template></Alert>
		    <div style="display: flex;align-items: center;">
		    	<img width="302px" height="400px" alt="" src="./images/pay.png" />
		    	<div style="padding: 0 60px">
		    		<img alt="" src="./images/pay-qrscan.png" />
		    		<div style="width:100%; text-align: center; color: #999;font-size: 16px;">
		    		<i-button @click="payDone">点我完成支付</i-button>
		    		</div>
		    	</div>
		    </div>
		    <script th:inline="javascript">
		    var vuePay = new Vue({
		        el: "#pay",
		        data: {
		           orderId:/*[[${orderId}]]*/ 0,
		        },
		        methods: {
		        	payDone(){
		        		let orderPay = {}
		        		orderPay.orderId = this.orderId
		        		orderPay.payType = "weixin"
		        		orderPay.payNo = new Date().getTime()
		        		orderPay.payTime = new Date().Format("yyyy-MM-dd hh:mm:ss")
		        		console.log(orderPay.payTime)
		        		orderPay.payStatus = "success"
		        		//第三方支付完成后执行，记录支付信息
		        		jQuery.ajax({
							url:GO8.DN.ROOT+"order/pay",
							type:'post',
							data: orderPay,
							dataType:'json',
							success:function(res){
								console.log(res)
							}
						})
						
						//付款成功跳转到成功页面
						if(orderPay.payStatus == "success"){
							window.location.href = GO8.DN.ORDER+"order/paySuccess.html?orderId="+this.orderId
						}
		        	} 
		        },
		    })
		    </script>
		</div>
    </div>
    <div id="footer" th:insert="footer :: copy"></div>
</body>

</html>
